<template>
  <section class="home">
    <index-swiper :lang="lang"></index-swiper>
    <div class="wrap-content home-content">
      <div class="home-introduce">
        <a href="https://www.liangzhunglobal.com/video/lz-video.mp4"
           target="_blank"
           class="introduce-img">
          <svg-icon icon-class="play"
                    class="play-btn" />
          <img src="~@/assets/imgs/index/left-img.png"
               alt="纳米等离子体共振光学芯片技术与应用">
          <div class="introduce-title">
            {{$t('page.company')}}
          </div>
        </a>
        <div class="home-news"
             v-if="lang === 'zh'">
          <index-news :newsData='newsList'></index-news>
        </div>
        <div class="home-contact"
             v-else>
          <div class="contact-box">
            <div class="contact-tt">Contact us</div>
            <div class="contact-item">
              <div class="name">Mr. Wang</div>
              <div class="way">Email：wangzhangming@liangzhun.com.cn</div>
              <div class="way">Phone：13262767406</div>
            </div>
            <div class="contact-item">
              <div class="name">Ms. Qi</div>
              <div class="way">Email：alinaqi@liangzhun.com.cn</div>
              <div class="way">Phone：18616202758</div>
            </div>
            <!-- <div class="contact-qr">
              <img src="~@/assets/imgs/index/qr@2x.png"
                   alt="">
            </div> -->
          </div>
        </div>
      </div>

      <qr-code style="position: absolute;top:0px;right:-150px;"></qr-code>
    </div>
  </section>
</template>

<script>
import indexSwiper from './components/indexSwiper.vue'
import indexNews from './components/indexNews.vue'
import QrCode from '@/components/QrCode'
import { fetchNewsList } from '@/api/common'
export default {
  name: '',
  data() {
    return {
      newsList: [],
      lang: '',
    }
  },
  mounted() {
    this.getNewsList()
    this.lang = this.$i18n.locale
  },
  components: {
    indexSwiper,
    indexNews,
    QrCode,
  },
  methods: {
    async getNewsList() {
      const res = await fetchNewsList()
      this.newsList = res.newsList
    },
  },
  watch: {
    '$i18n.locale'(language) {
      this.lang = language
    },
  },
}
</script>

<style lang='scss' scoped>
@import '~@/theme/mixin';
.home {
  &-content {
    position: relative;
    margin-top: 20px;
  }
  &-introduce {
    margin-bottom: 50px;
    @include clearfix();
    .introduce-img {
      position: relative;
      display: block;
      float: left;
      width: 335px;
      cursor: pointer;
      img {
        width: 100%;
      }
      .play-btn {
        position: absolute;
        top: 50%;
        left: 50%;
        font-size: 70px;
        transform: translate(-50%, -50%);
      }
    }
    .introduce-title {
      position: absolute;
      line-height: 50px;
      bottom: 0;
      width: 100%;
      padding-left: 20px;
    }
  }
  &-contact {
    float: left;
    width: calc(100% - 335px);
    overflow: hidden;
    color: #fff;

    .contact-box {
      position: relative;
      box-sizing: border-box;
      background: url('~@/assets/imgs/index/content@2x.png');
      background-size: 100%;
      min-height: 240px;
      border-radius: 8px;
      padding: 20px;
      margin-left: 20px;
    }
    .contact-tt {
      font-size: 19px;
      margin-bottom: 20px;
    }
    .contact-item {
      margin-bottom: 20px;
      .name {
        font-size: 14px;
        margin-bottom: 8px;
      }
      .way {
        font-size: 14px;
      }
    }
    .contact-qr {
      position: absolute;
      width: 110px;
      right: 20px;
      bottom: 20px;
      img {
        width: 100%;
      }
    }
  }
  &-news {
    float: left;
    width: calc(100% - 335px);
  }
}
</style>